package so.wy.servicecenter.businessbed.service.hospital;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import so.wy.servicecenter.base.exception.ServiceException;
import so.wy.servicecenter.base.frame.baseopt.BaseOptService;
import so.wy.servicecenter.businessbed.dao.rdb.hospital.hospital_rent_time.HospitalRentTimeDAO;
import so.wy.servicecenter.businessbed.dao.rdb.hospital.hospital_rent_time.HospitalRentTimeDO;
import so.wy.servicecenter.businessbed.service.hospital.dto.HospitalRentTimeDTO;
import so.wy.servicecenter.data.dao.enums.YesNoEnum;

@Service
@Scope("prototype")
public class HospitalRentTimeService extends BaseOptService<HospitalRentTimeDAO, HospitalRentTimeDO, HospitalRentTimeDTO> {

    @Override
    protected HospitalRentTimeDTO convert2DTO(HospitalRentTimeDO hospitalRentTimeDO) {
        return new HospitalRentTimeDTO(hospitalRentTimeDO);
    }

    @Override
    protected HospitalRentTimeDO convert2DO(HospitalRentTimeDTO hospitalRentTimeQuery) {
        return hospitalRentTimeQuery.convert2DO();
    }

    @Override
    public HospitalRentTimeDTO addRecord(HospitalRentTimeDTO recordQuery) throws ServiceException {
        recordQuery.setIsOpen(YesNoEnum.NO.getCode());
        return super.addRecord(recordQuery);
    }
}
